<template>
  <el-dropdown trigger="click" @command="changeLanguage">
    <div>
      <svg-icon style="color:#fff;font-size:20px" icon-class="language" />
    </div>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item command="zh" :disabled="'zh'=== $i18n.locale ">中文</el-dropdown-item>
      <el-dropdown-item command="en" :disabled="'en'=== $i18n.locale ">en</el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>

<script>
// 导入局部组件必须在scrip里面导入,在App里面导入
export default {
// 组件名称
  name: '',
  // 接收局部注册的组件
  components: {},
  // 组件参数接收来自父组件的数据
  props: {},
  // 组件数据
  data () {
    return {}
  },
  methods: {
    changeLanguage (lang) {
      this.$i18n.locale = lang // 设置给本地的i18n插件
      this.$message.success('切换多语言成功')
    }
  }
}
</script>
<style lang='less' scoped>

</style>
